﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WJP.Domain
{
    /// <summary>
    /// 查询对象的基类
    /// </summary>
    [Serializable]
    public abstract class Criteria : Entity, ILoadOptionsCriteria
    {
        /// <summary>
        /// 查询对象的基类
        /// </summary>
        public Criteria()
        {
            PagingInfo = new PagingInfo()
            {
                PageNumber = 1,
                PageSize = 50,
                IsNeedCount = true,
            };
        }

        /// <summary>
        /// 分页条件
        /// <para>如果这个属性为null或者是<see cref="Domain.PagingInfo.Empty"/>，表示不需要进行分页查询，直接返回整个结果集</para>
        /// </summary>
        public PagingInfo PagingInfo { get; set; }

        /// <summary>
        /// 查询数据的方法
        /// </summary>
        /// <returns></returns>
        protected internal virtual EntityList Fetch()
        {
            return null;
        }
    }
}
